#include <iostream>
#include <map>
#include <string>
#include <vector>
//
// Created by Administrator on 2025/9/3.
//
int main()
{
    std::map<std::string, std::vector<std::string>> families;
    while (true)
    {

        std::cout << "Please add a family lastName (input q to quit): " << std::endl;
        std::string lastName;
        std::cin >> lastName;
        if (lastName == "q")
        {
            break;
        }
        families[lastName] = std::vector<std::string>();
        std::string firstName;
        std::cout << "firstNames (input q to quit): ";
        while (std::cin >> firstName && firstName != "q")
        {
            families[lastName].push_back(firstName);
        }
        std::cout << std::endl;

    }

    std::cout << std::endl;
    for (const auto &family : families)
    {
        std::cout << "family: " << family.first << "  ";
        std::cout << "people: ";
        for (const auto &firstName : family.second)
        {
            std::cout << firstName << " ";
        }
        std::cout << std::endl;
    }

}